package edu.chalmers.se.tda367.main;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import edu.chalmers.se.tda367.controller.UserController;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import edu.chalmers.se.tda367.database.Database;
import edu.chalmers.se.tda367.model.User;

/**
 *
 * @author pierrereimertz
 */
public class PluggisInitiator {

    public PluggisInitiator() throws FileNotFoundException {


        //Initiera databasen och lägg in användare i den


        Scanner scanner = new Scanner(new File("database/database.data"));
        scanner.useDelimiter(System.getProperty("line.separator"));

        Database db = Database.getInstance();
        List<User> tdb = new ArrayList();

        /*       while (scanner.hasNext()) {
        String st = scanner.next();
        User temp = UserController.lineToUser(st);

        tdb.add(temp);

        db.addToTempDbFileString(st + "\n");
        }

         */
        db.setDatabase(tdb);
        scanner.close();
    }
}
